package com.zhongying.jf.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 
* @ClassName: ZmxyUtil 
* @Description: 芝麻信用工具类 
* @author wanghai
* @date 2017年3月9日 下午4:29:04 
*
 */
public class ZmxyUtil {
	
    public static long Transaction_SEQ = 0; 
    
    
	public static String getTransactionId() {
	    Date date = new Date();
	    Transaction_SEQ ++;
	    String seq = String.valueOf(Transaction_SEQ);
	    if (seq.length() > 13) {
	        Transaction_SEQ = 0;
	        seq = "0";
	    }
	    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmssSSS");
	    String transaction_id = sdf.format(date) + "0000000000000";
	    transaction_id = transaction_id.substring(0, transaction_id.length() - seq.length()) + seq; 
	    return transaction_id;
	}
	
	public static boolean notNull(Object obj) {
	    if (obj != null) {
	        if (String.valueOf(obj).length() != 0) {
	            return true;
	        }
	    }
	    return false;
	}
	
	
	public static void main(String[] args) {
	    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmssSSS");
	    System.out.println(sdf.format(new Date()));
	    System.out.println(new Date().getTime());
	    System.out.println(getTransactionId());
	}
	
}
